
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"adminpw", "node_count":"3"}'

sleep 2
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"adminpw", "port": 5984, "node_count": "3", "remote_node": "couchdb1.test", "remote_current_user": "admin", "remote_current_password": "adminpw" }'

sleep 2
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup  -d '{"action": "add_node", "host":"couchdb1.test", "port": 5984, "username": "admin", "password":"adminpw"}'

sleep 2
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup -d '{"action": "enable_cluster", "bind_address":"0.0.0.0", "username": "admin", "password":"adminpw", "port": 5984, "node_count": "3", "remote_node": "couchdb2.test", "remote_current_user": "admin", "remote_current_password": "adminpw" }'

sleep 2
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup  -d '{"action": "add_node", "host":"couchdb2.test", "port": 5984, "username": "admin", "password":"adminpw"}'

sleep 2
curl -X POST -H "Content-Type: application/json" http://admin:adminpw@localhost:5984/_cluster_setup -d '{"action": "finish_cluster","username": "admin", "password":"adminpw"}'

sleep 1
curl http://admin:adminpw@localhost:5984/_membership
